import { useMemo } from "react"
import { useLoaderData } from "react-router-dom"

const useAuthBtn = (val) => {
    const authButton = useLoaderData() // 获取路由中loader函数的返回值，也就是权限的数组
    const isShow = useMemo(() => { return authButton.includes(val) }, [authButton]) // 判断数组中是否包含add这个添加权限
    return isShow;
}

export default useAuthBtn;